11516 - WiFi (Binary search + greedy)
[andmenj-acm.git] / 11436 - Cubes EXTREME! / j.2.cpp
blob09cf0a125922c1c550cd19056674dea453521410
1 #include<iostream>
2 #include<math.h>
3 #include <set>
5 using namespace std;
7 typedef unsigned long long ull;
9 set<ull> cubos;
13 int main(){
14 ull n;
15 for (ull i = 1; i < 2642246; ++i){
16 cubos.insert(cubos.end(), i*i*i);
18 /*set<ull>::iterator i = cubos.end();
19 --i;
20 cout << (*i) << endl;*/
22 while(cin>>n &&n){
23 set<ull>::iterator i = cubos.upper_bound(n);
24 cout << "(*i) es: " << (*i) << endl;
25 if (i != cubos.end()){
26 set<ull>::iterator j = cubos.find((*i) - n);
27 if (j != cubos.end()){
28 cout << "(*j) es: " << (*j) << endl;
29 cout << (ull)pow((*i), 1./3.) << " " << (ull)pow((*j), 1./3.) << endl;
30 }else{
31 cout << "No solution\n";
33 }else{
34 cout<< "No solution\n";